import request from '@/utils/request'

const api = {
    moduleapi: '/system/role'
}

const ryApi = {
    moduleapi: '/rysh'
}

export function optionselect(parameter) {
    return request({
        url: api.moduleapi + '/optionselect',
        method: 'get',
        params: parameter
    })
}

export function getList(parameter) {
    return request({
        url: api.moduleapi + '/list',
        method: 'get',
        params: parameter
    })
}

export function getAllList(parameter) {
    return request({
        url: '/role/listAll', // 更换接口
        method: 'get',
        params: parameter
    })
}

export function getInfo(unid) {
    return request({
        url: api.moduleapi + '/' + unid,
        method: 'get'
    })
}

export function saveModule(parameter) {
    return request({
        url: api.moduleapi,
        method: 'post',
        data: parameter,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

export function updateModule(parameter) {
    return request({
        url: api.moduleapi,
        method: 'post',
        data: parameter,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

export function updateDataScope(parameter) {
    return request({
        url: api.moduleapi + '/dataScope',
        method: 'post',
        data: parameter,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

export function delModule(unids) {
    console.log(unids);
    return request({
        url: api.moduleapi,
        method: 'Delete',
        params: unids
    })
}

export function saveRyModule(parameter) {
    return request({
        url: ryApi.moduleapi,
        method: 'post',
        data: parameter,
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

export const qbglExport = api.qbgl + '/export'